﻿Public Class XLHeSo
    Private kn As KNHeSo
    Public Function BUS_DSHS() As DataTable
        kn = New KNHeSo
        Return kn.DSHS()
    End Function
    Public Function BUS_SaveHS(ByVal data As DataTable) As Boolean
        Dim kn = New KNHeSo
        Return kn.SaveHS(data)
    End Function
    Public Function BUS_DSNV() As List(Of DTO_NhanVienCT.NhanVien)
        Dim kn As New KNNhanVien
        Return kn.DSNhanVien()
    End Function
    Public Sub BUS_LamMoi(ByRef data As DataTable, ByVal ds As List(Of DTO_NhanVienCT.NhanVien))
        If data.Rows.Count <> 0 Then
            For Each nv As DTO_NhanVienCT.NhanVien In ds
                Dim kq As Boolean = False
                For Each dr As DataRow In data.Rows
                    If dr("MaNV") = nv.MaNV Then
                        kq = True
                    End If
                Next
                If kq = False Then
                    Dim n As DataRow = data.NewRow
                    n("MaNV") = nv.MaNV
                    data.Rows.Add(n)
                End If
            Next
        Else
            For Each nv As DTO_NhanVienCT.NhanVien In ds
                Dim dr As DataRow = data.NewRow
                dr("MaNV") = nv.MaNV
                data.Rows.Add(dr)
            Next
        End If
    End Sub
    Public Function BUS_TimNV(ByVal str As String, ByVal ds As List(Of DTO_NhanVienCT.NhanVien)) As String
        Dim kq As String = ""
        For Each nv As DTO_NhanVienCT.NhanVien In ds
            If nv.MaNV = str Then
                kq = nv.HoTen
                Exit For
            End If
        Next
        Return kq
    End Function
    Public Function BUS_ArrHS() As ArrayList
        Dim ds As New ArrayList
        ds.Add("[ Chọn Hệ Số ]")
        ds.Add("1")
        ds.Add("1.5")
        ds.Add("2")
        ds.Add("2.5")
        ds.Add("3")
        ds.Add("3.5")
        ds.Add("4")
        ds.Add("4.5")
        ds.Add("5")
        ds.Add("5.5")
        ds.Add("6")
        ds.Add("6.5")
        ds.Add("7")
        ds.Add("7.5")
        ds.Add("8")
        ds.Add("8.5")
        ds.Add("9")
        ds.Add("9.5")
        Return ds
    End Function
End Class
